# !/usr/bin/python
# _*_ coding: utf-8 _*_
# @Time : 2021/5/25 3:48 下午
# @Author : liujun
# @File : my_casbin.py
# @desc : 自定义权限验证

import casbin
import casbin_sqlalchemy_adapter

from db.session import engine
from core.config import settings


def get_casbin() -> casbin.Enforcer:
    adapter = casbin_sqlalchemy_adapter.Adapter(engine)
    e = casbin.Enforcer(settings.CASBIN_MODEL_PATH, adapter, True)
    return e
